import { defineStore } from "pinia";

export const useDeviceStore = defineStore("device", {
	state: () => ({
		deviceMapList: [] as DeviceMap[],
		defaultDeviceMap: null as DeviceMap | null,
		planList: [] as Plan[],
		defaultPlan: null as Plan | null,
		zonesList: [] as ZoneDisplay[],
		settingJson: null as any,
		shopList: [] as any[],
		uurl: "" as string, // 获取避雨点方法的参数
		deviceStatus: null as DeviceStatus | null,
		devicePosition: null as ShopStyle | null, //设备位置
		deviceProgress: null as any, //设备进程
		showGray: false as boolean,
		zones: [] as ZoneItem[],
		selZone: [] as ZoneItem[],
		tipsMsg: "" as string, //设备提示
	}),
	actions: {
		setDeviceMapList(maps: DeviceMap[]) {
			this.deviceMapList = maps;
		},
		setUurl(url: string) {
			// 根据需求实现
			this.uurl = url;
		},
		setDeviceStatus(currentStatus: DeviceStatus) {
			this.deviceStatus = currentStatus;
		},
		clearStore() {
			this.zones = [];
			this.zonesList = [];
			this.planList = [];
		},
	},
});
